﻿<!DOCTYPE html>
<html>
<head>
	<%
	include("/static/include/title.html"){}
	include("/static/include/css.html"){}
	include("/static/include/js.html"){}
	%>
</head>

<body>
<div class="layui-fluid">
	<form class="layui-form" action="articleSelect.do" method="post" onsubmit="return false">
		<input type="hidden" id="dialogId" name="dialogId" value="${parameter.dialogId}"/>
		<input type="hidden" name="multiple" value="${parameter.multiple}"/>
		<div class="layui-card">
			<div class="layui-card-body">

				<div class="layui-form-item">

					<div class="layui-inline">
						<label class="layui-form-label">信息分类</label>
						<div class="layui-input-inline">
							<select name="article.categoryCode" style="width:150px" onchange="changeQuery();">
								<option value="">--请选择--</option>
								<% if(has(categoryList) && categoryList != null) { for(i in categoryList) {%>
								<option value="${i.itemCode}"<% if(article.categoryCode == i.itemCode) {%> selected<%}%>>${i.itemName}</option>
								<%}}%>
							</select>
						</div>
					</div>

					<div class="layui-inline">
						<label class="layui-form-label">头像图片地址：</label>
						<div class="layui-input-inline">
							<input type="text" name="article.imageUrl" value="${@team.bangbang.common.utility.LogicUtility.getQuotedString(article.imageUrl)}"
								   class="layui-input" style="width:150px" maxlength="100" onchange="changeQuery();" onkeydown="enterIn(event);"/>
						</div>
					</div>

					<div class="layui-inline">
						<label class="layui-form-label">标题：</label>
						<div class="layui-input-inline">
							<input type="text" name="article.title" value="${@team.bangbang.common.utility.LogicUtility.getQuotedString(article.title)}"
								   class="layui-input" style="width:150px" maxlength="100" onchange="changeQuery();" onkeydown="enterIn(event);"/>
						</div>
					</div>

					<div class="layui-inline">
						<label class="layui-form-label">副标题或者摘要：</label>
						<div class="layui-input-inline">
							<input type="text" name="article.subTitle" value="${@team.bangbang.common.utility.LogicUtility.getQuotedString(article.subTitle)}"
								   class="layui-input" style="width:150px" maxlength="250" onchange="changeQuery();" onkeydown="enterIn(event);"/>
						</div>
					</div>

					<div class="layui-inline">
						<label class="layui-form-label">状态{1：待上架2：已上架}：</label>
						<div class="layui-input-inline">
							<select name="article.statusFlag" style="width:150px" onchange="changeQuery();">
								<option value="">--请选择--</option>
								<% if(has(statusList) && statusList != null) { for(i in statusList) {%>
								<option value="${i.key}"<% if(article.statusFlag == i.key) {%> selected<%}%>>${i.value}</option>
								<%}}%>
							</select>
						</div>
					</div>

					<div class="layui-inline">
						<label class="layui-form-label">发布人：</label>
						<div class="layui-input-inline">
							<input type="text" name="article.posterName" value="${@team.bangbang.common.utility.LogicUtility.getQuotedString(article.posterName)}"
								   class="layui-input" style="width:150px" maxlength="25" onchange="changeQuery();" onkeydown="enterIn(event);"/>
						</div>
					</div>

					<div class="layui-inline">
						<label class="layui-form-label">更新时间：</label>
						<div class="layui-input-inline">
							<input type="text" name="article.updateTimeBottom" id="updateTimeBottom"  maxlength="16" value='${article.updateTimeBottom, "yyyy-MM-dd"}' readonly="true" class="layui-input" onchange="changeQuery();"/>
							~
							<input type="text" name="article.updateTimeTop" id="updateTimeTop" maxlength="16" value='${article.updateTimeTop, "yyyy-MM-dd"}' readonly="true" class="layui-input" onchange="changeQuery();"/>
						</div>
					</div>

					<div class="layui-inline">
						<a class="layui-btn layui-btn-normal" onclick="submitForm();">查询</a>
						<a class="layui-btn" onclick="onSelected();"><i class="layui-icon layui-icon-ok"></i> 确定选择</a>
						<a class="layui-btn layui-btn-warm" onclick="onClear();"><i class="layui-icon layui-icon-circle"></i> 清除选择</a>
					</div>
				</div>

				<table class="layui-table" lay-data="{id:'selectTable',limit:${pagination.maxResults}}">
					<!--
                     * ！！除非设计、指导人员有特别说明，否则此处的数据列不得随意增加、修改、删除！！
                     * －－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－
                     *
                     * 为了页面效果，可以隐藏相关数据列。隐藏数据列，请修改相应的表头<th/>标签：
                     *
                     * 修改lay-data属性，添加 hide:true，例如：
                     *
                     * <th lay-data="{field:'activeFlag',hide:true}"></th>
                    -->
					<thead>
					<tr>
						<th class="center" lay-data="{field:'id',width:40,type:'${(!isEmpty(parameter.multiple) && parameter.multiple == 'true') ? "checkbox" : "radio"}', fixed: 'left'}">${(!isEmpty(parameter.multiple) && parameter.multiple == 'true') ? "" : "选择"}</th>

						<th lay-data="{field:'categoryCode',hide:true}"></th>
						<th class="center" lay-data="{field:'category',width:100}">分类编码，关联config_item_base.ItemCode[Category=信息分类]</th>

						<th lay-data="{field:'imageUrl'}">头像图片地址</th>

						<th lay-data="{field:'title'}">标题</th>

						<th lay-data="{field:'subTitle'}">副标题或者摘要</th>

						<th lay-data="{field:'statusFlag',hide:true}"></th>
						<th class="center" lay-data="{field:'statusFlag',width:100}">状态{1：待上架2：已上架}</th>

						<th lay-data="{field:'posterName'}">发布人</th>

						<th class="center" lay-data="{field:'updateTime',width:150}">更新时间</th>

					</tr>
					</thead>
					<tbody>
					<% if(has(articleList) && articleList != null){ for(i in articleList) {%>
					<tr>
						<td>${i.id}</td>

						<td>${i.categoryCode}</td>
						<td>${i.category.itemName!}</td>

						<td>${@team.bangbang.common.utility.LogicUtility.getHTMLString(i.imageUrl)}</td>

						<td>${@team.bangbang.common.utility.LogicUtility.getHTMLString(i.title)}</td>

						<td>${@team.bangbang.common.utility.LogicUtility.getHTMLString(i.subTitle)}</td>

						<td>${i.statusFlag}</td>
						<td>${i.statusName}</td>

						<td>${@team.bangbang.common.utility.LogicUtility.getHTMLString(i.posterName)}</td>

						<td>${i.updateTime, "yyyy-MM-dd"}</td>

					</tr>
					<%}}%>
					</tbody>
				</table>
			</div>

			<div id="pagination" recordCount="${pagination.recordCount}" pageNo="${pagination.pageNo}" pageSize="${pagination.maxResults}"></div>
		</div>
	</form>
</div>
</body>
<script>
    layui.use(['form','table','laydate'], function(){
        var form  = layui.form;
        var laydate = layui.laydate;

        // 渲染表单radio、select、checkbox
        form.render();

        // 更新时间下限
        laydate.render({
            elem: '#updateTimeBottom',
            format: 'yyyy-MM-dd'
        });
        // 更新时间上限
        laydate.render({
            elem: '#updateTimeTop',
            format: 'yyyy-MM-dd'
        });

    });

    // 确定选择
    function onSelected() {
        //获取checkbox选中的值
        var checkStatus = layui.table.checkStatus('selectTable');
        var data = checkStatus.data;

        if(data == null || data.length == 0) {
            $.message("没有选择任何数据哦！");
            return;
        }

        var result = {
            "statusCode" : 100,
            "message" : "",
            "dto" : data
        };

        returnDialog(result);
    }

    // 清除选择
    function onClear() {
        var result = {
            "statusCode" : 100,
            "message" : ""
        };

        returnDialog(result);
    }
</script>
</html>
